package com.pureland.demo.domain.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.pureland.common.entity.SuperEntity;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * @projectName: pureland_cloud
 * @className: com.pureland.demo.domain.entity.Goods
 * @description: 商品实体类
 * @author: tong.li
 * @createTime: 2020/10/12 17:31
 * @version: v1.0
 * @copyright: 版权所有 李彤 © 2020
 */
@TableName("t_goods")
public class Goods extends SuperEntity<Long> implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 商品名称
     */
    @ApiModelProperty(value = "商品名称")
    @NotBlank(message = "商品名称不能为空")
    @Length(min = 2, max = 20, message = "商品名称字符数请控制在2-20位")
    private String name;

    /**
     * 商品价格
     */
    @ApiModelProperty(value = "商品价格")
    private BigDecimal price;


    /**
     * 商品总数
     */
    @ApiModelProperty(value = "商品总数")
    @NotNull(message = "商品数量不能为空")
    @Min(value = 1 , message = "商品总数至少为1")
    private Integer total;


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

}
